package com.lcz.demo.customerorder;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
//
@Entity
// @Table(name=””) 用来指定映射表的表名。
@Table
public class Customer {
    @Id
    private  int id;
    @NotBlank
    private  String name;
    @NotBlank
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    public  String password;
    @NotBlank
    @Email
   private  String email;

    //Spring Data Jpad 的构造器
    public Customer() {
    }

    public Customer(int id, String name, String password, String email) {
        this.id = id;
        this.name = name;
        this.password = password;
        this.email = email;
    }

    public int getId() {
        return id;
    }
@JsonProperty("ccc")
public int getCustomer(){
        return id;
    }

    public String getName() {
        return name;
    }
@JsonIgnore
    public String getPassword() {
        return password;
    }

    public String getEmail() {
        return email;
    }

    @Override
    public String toString() {
        return "Customer{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", password='" + password + '\'' +
                ", email='" + email + '\'' +
                '}';
    }
}
